home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
bytjl86b.arc
/
PCRACK.BAS
< prev
next >
Wrap
BASIC Source File
|
1985-07-12
|
2KB
|
64 lines
1000 REM -------------------------------------
1010 REM PROGRAM PCRACK.BAS IN MICROSOFT BASIC
1020 REM -------------------------------------
1030 REM PROGRAM USAGE NOTES
1040 REM (1) USE CONSISTENT PHYSICAL UNITS
1050 REM (2) NUMBER OF ELEMENTS <= 30
1060 REM -----------------------------------
1070 DEFINT I-N
1080 OPTION BASE 1
1090 DIM A(30,30),DY(30)
1100 REM --------------------------------- READ BASIC MODEL PARAMETERS
1110 INPUT "CRACK PRESSURE, CRACK LENGTH, NUMBER OF ELEMENTS";P,CL,N
1120 W=CL/(2!*N)
1130 INPUT "MATERIAL PROPERTIES - G,PR";G,PR
1140 REM ----------------------------------------------- SET CONSTANTS
1150 PI=3.14159
1160 CON=-G/(PI*W*(1!-PR))
1170 REM --------------------------- GAUSS-SEIDEL ITERATION PARAMETERS
1180 TOL= .00001
1190 ITMAX=2*N
1200 OMEGA=1.3
1210 REM -------------------------- INITIALIZE DY AND COMPUTE A MATRIX
1220 FOR I=1 TO N
1230 DY(I)=0!
1240 FOR J=1 TO N
1250 A(I,J)=CON/(4!*(J-I)^2 - 1!)
1260 NEXT J
1270 NEXT I
1280 REM ------------------- SOLVE EQUATIONS BY GAUSS-SEIDEL ITERATION
1290 FOR NUM = 1 TO ITMAX
1300 ERRMAX=0!
1310 FOR I=1 TO N
1320 TEMP=0!
1330 FOR J=1 TO N
1340 TEMP=TEMP+A(I,J)*DY(J)
1350 NEXT J
1360 TEMP=(P-TEMP)/A(I,I)
1370 DY(I)=DY(I)+OMEGA*TEMP
1380 ERRI=ABS(TEMP)
1390 IF ERRI > ERRMAX THEN ERRMAX=ERRI
1400 NEXT I
1410 IF ERRMAX <= TOL THEN GOTO 1460
1420 PRINT USING"ITERATION, MAXIMUM ITERATE ## #.######";NUM;ERRMAX
1430 NEXT NUM
1440 PRINT "ITERATION PROCESS DID NOT CONVERGE AFTER";ITMAX;" ITERATIONS!"
1450 STOP
1460 REM ----------------------------------------------- PRINT RESULTS
1470 PRINT "ELEM CRACK OPENING CRACK OPENING COMPUTED STRESS"
1480 PRINT " (NUMERICAL) (ANALYTICAL)"
1490 DELB=CL/N
1500 X=-(CL+DELB)/2!
1510 B=CL/2
1520 CON=2!*(1!-PR)*P*B/G
1530 FOR I = 1 TO N
1540 SIGYY=0!
1550 FOR J = 1 TO N
1560 SIGYY=SIGYY+A(I,J)*DY(J)
1570 NEXT J
1580 X=X+DELB
1590 DD=CON*SQR(1!-(X^2/B^2))
1600 PRINT USING" ## ##.#### ##.#### ######.#";I;DY(I);DD;SIGYY
1610 NEXT I
1620 END
0 DD=CON*SQR(1!-(X^2/